package cn.com.dhcc.turbo.service.registry;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.com.dhcc.app.core.exception.DaoException;
import cn.com.dhcc.app.core.exception.ServiceException;
import cn.com.dhcc.app.core.service.BaseService;
import cn.com.dhcc.turbo.dao.registry.MonitorQuotaDao;
import cn.com.dhcc.turbo.entity.monitor.MonitorShowVO;
import cn.com.dhcc.turbo.entity.registry.MonitorQuota;
import cn.com.dhcc.turbo.entity.registry.MonitorQuotaConf;

/**
 * 监控指标service
 * 
 * @日期：2014-6-12 下午3:14:58
 * @作者：张洪涛
 * @版权所有：东华软件
 * @版本：1.0
 */
@Service
public class MonitorQuotaService extends BaseService {
	@Autowired
	private MonitorQuotaDao mqDao;

	public List<MonitorQuota> list() throws ServiceException {
		try {
			return mqDao.list();
		} catch (DaoException e) {
			throw new ServiceException("获取监控指标信息列表失败", e);
		}
	}

	public MonitorQuota get(String id) throws ServiceException {
		try {
			return mqDao.get(id);
		} catch (DaoException e) {
			throw new ServiceException("获取监控指标失败", e);
		}
	}

	public int updateMonitorQuota(MonitorQuotaConf vo) throws ServiceException {
		try {
			return mqDao.updateMonitorQuota(vo);
		} catch (DaoException e) {
			throw new ServiceException("获取监控指标失败", e);
		}

	}

	public int insertMonitorQuota(MonitorQuotaConf vo) throws ServiceException {
		{
			try {
				return mqDao.insertMonitorQuota(vo);
			} catch (DaoException e) {
				throw new ServiceException("获取监控指标失败", e);
			}

		}
	}

	public int updateStatus(String id, String status) throws ServiceException {
		try {
			return mqDao.updateStatus(id,status);
		} catch (DaoException e) {
			throw new ServiceException("修改指标状态失败", e);
		}
	}

	public List<MonitorShowVO> getMonitorShow(String[] codes,String ownerId)  throws ServiceException {
		try {
			return mqDao.getMonitorShow(codes,ownerId);
		} catch (DaoException e) {
			throw new ServiceException("获取指标失败", e);
		}
	}
}
